export default{
    data () {
        return {
            commonColumnConfig: {
                minWidth: 100,
                align: 'center',
                rule: { required: true, message: '不能为空', trigger: 'blur' }
            }
        }
    },
    methods: {
        getColumnType (type, hier) {
            if (type === '单选') {
                return { type: 'radio', options: this.getParamOptions(hier) }
            } else if (type === '多选') {
                return { type: 'multiCheck', options: this.getParamOptions(hier) }
            } else if (type === '区间数值' || type === '数字框') {
                return { type: 'number' }
            } else {
                return { type: 'text' }
            }
        },
        // 获取单选/多选时选项
        getParamOptions (hier) {
            let paramOptions = [];
            if (!hier || hier.length === 0 || !hier[0].basic || hier[0].basic.length === 0 || !hier[0].basic[0].values) {
                return paramOptions;
            }
            paramOptions = hier[0].basic[0].values.params.map(d => {
                return {
                    label: d.codeName,
                    value: d.codeName
                }
            })
            return paramOptions;
        }
    }
}
